//package filter;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
//public class TestFilter implements Filter {
//    //使用过滤器实现登陆验证功能：如果登录成功可以进行下一步请求操作，
//    //                          如果登录不成功不能进行下一步，还是显示登陆页面
//    String []urls={"/financial_payment_management_system4/web/login.jsp","/financial_payment_management_system4/web/ticket-open.jsp"};
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//        System.out.println("TestFilter初始化");
//
//    }
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        boolean boo=false;
//        HttpServletRequest httpServletRequest=(HttpServletRequest)servletRequest;
//        HttpServletResponse httpServletResponse= (HttpServletResponse) servletResponse;
//        for (String s : urls) {
//            if (s.equals(httpServletRequest.getRequestURI())){
//                boo=true;
//                break;
//            }
//        }
//        if (boo){
//            filterChain.doFilter(servletRequest,servletResponse);
//        }else{
//
//            httpServletResponse.sendRedirect("login.jsp");
//        }
//
//
//    }
//
//    @Override
//    public void destroy() {
//        System.out.println("TestFilter销毁");
//
//    }
//}
